package org.tloss.web.editor.model.oper.math;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

import org.tloss.web.editor.database.editors.jdbc.Table;
import org.tloss.web.editor.utils.Constants;

public class EntityOperand extends MathOperand {
	private String name;

	@XmlAttribute
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	private Table table;

	@XmlElement
	public Table getTable() {
		return table;
	}

	public void setTable(Table table) {
		this.table = table;
	}

	public String getDisplayText() {

		return "" + name + "[" + table.getTableName() + "]";
	}

	@Override
	public String generate(int type, Object[] param) {
		if (type == Constants.CodeType.JAVA) {
			return "" + name;
		}
		return null;
	}

	@Override
	public String getType() {
		return Constants.ENTITY_FOLDER + "." + name;
	}

}
